//
//  LoginAndRegistController.m
//  History
//
//  Created by 七 on 16/9/6.
//  Copyright © 2016年 kane. All rights reserved.
//

#import "LoginAndRegistController.h"
#import "LoginViewController.h"
#import "RegistViewController.h"
@interface LoginAndRegistController ()
{
    __weak IBOutlet UIButton *registBtn;
    __weak IBOutlet UIButton *loginBtn;
    
    __weak IBOutlet UIImageView *iconImageView;
    
    __weak IBOutlet UIButton *backBtn;
    
    
    
    
    
}
@end

@implementation LoginAndRegistController

- (void)viewDidLoad {
    [super viewDidLoad];
    [iconImageView drawCornerRadius:8];
    [registBtn drawCornerRadius:5.0];
    loginBtn.layer.cornerRadius = 5.0;
    loginBtn.layer.borderWidth = 1.0;
    loginBtn.layer.borderColor = [UIColor colorWithHex:0X46C09A].CGColor;
    if (_isFromSetView) {
        [backBtn setHidden:YES];
    }else{
        [backBtn setHidden:NO];
    }
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    if ([UserEntity sharedUser].loginSuccess) {
        [self.navigationController popViewControllerAnimated:NO];
        if (!_isFromSetView) {
            [[NSNotificationCenter defaultCenter] postNotificationName:NotificationLoginSuccess object:@1];
        }
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - User Action
- (IBAction)registPress:(id)sender {
    RegistViewController *registVC = [[RegistViewController alloc] init];
    [self presentViewController:registVC animated:YES completion:nil];
}

- (IBAction)loginPress:(id)sender {
    LoginViewController *loginVC = [[LoginViewController alloc] init];
    [self presentViewController:loginVC animated:YES completion:nil];
}

- (IBAction)sinaLoginPress:(id)sender {
    
}

- (IBAction)QQLoginPress:(id)sender {
    
}
- (IBAction)backPress:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
    
}

@end
